package cn.aitrox.ry.service.user.api;

import cn.aitrox.ry.bean.CommonPageInfo;
import cn.aitrox.ry.bean.JwtTokenCheckResult;
import cn.aitrox.ry.bean.RespResult;
import cn.aitrox.ry.common.service.api.dto.User;
import cn.aitrox.ry.service.user.dto.in.UserCountInDto;
import cn.aitrox.ry.service.user.dto.in.UserCreateInDto;
import cn.aitrox.ry.service.user.dto.in.UserEditInDto;
import cn.aitrox.ry.service.user.dto.in.UserForgetPwdInDto;
import cn.aitrox.ry.service.user.dto.in.UserListInDto;
import cn.aitrox.ry.service.user.dto.in.UserLoginInDto;
import cn.aitrox.ry.service.user.dto.in.UserSearchInDto;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface UserApi {

    @PostMapping(value = "/user")
    RespResult create(@RequestBody UserCreateInDto input);

    @PutMapping(value = "/user")
    RespResult edit(@RequestBody UserEditInDto input);

    @GetMapping(value = "/user/{id}")
    RespResult<User> read(@PathVariable("id") Integer id);

    @PostMapping(value = "/user/search")
    CommonPageInfo<User> search(@RequestBody UserSearchInDto input);

    @PostMapping(value = "/user/login")
    RespResult<User> login(@RequestBody UserLoginInDto input);

    @PutMapping(value = "/user/forget/pwd")
    RespResult forgetPwd(@RequestBody UserForgetPwdInDto input);

    @PostMapping(value = "/user/list")
    List<User> list(@RequestBody UserListInDto input);

    @PostMapping(value = "/user/count")
    Integer count(@RequestBody UserCountInDto input);

    @GetMapping(value = "/user/token/auth")
    JwtTokenCheckResult<User> tokenAuth(@RequestParam("token") String token);

}
